<meta http-equiv="content-type" content="text/html;charset=utf-8">
 <script src="../js/jquery.1.7.2.min.js"></script>
 <link href="../layui/css/layui.css" rel="stylesheet" type="text/css"/>
 <script src="../layer/layer.js"></script>
 <script src="../layui/layui.js"> </script>
 <?
include '../config.inc.php';
$username = @$_POST['username'];
$password = @$_POST['password'];
include '../member.php';
if($admin != '1'){
  exit;
}
//判断是否存在没有领取完成的红包
$redball = mysql_query("SELECT * FROM wwk_chat_redball WHERE type='0'");
$red = mysql_fetch_array($redball);
if($red['type'] != ''){
  echo '存在没有领取完的红包!';
  exit;
}else{
$ball_money = @$_POST['ball_money'];
$ball_number = @$_POST['ball_number'];
$ball_type = @$_POST['ball_type'];
?> 
<script>
var username = '<? echo $username;?>'
var password = '<? echo $password;?>'
var user_vip = '<? echo $user_vip;?>'

var cion = '1000'
var sendvalue = '红包金额：<?echo $ball_money?><br>红包个数：<?echo $ball_number?><br><br>'
</script>
<?

if(!mysql_query("INSERT INTO wwk_chat_redball (id,nickname , username, money,number,last_number,type,red_type) 
VALUES ('','$nickname' , '$username','$ball_money','$ball_number','$ball_number','0','$ball_type')")){
   echo '发送失败,请联系开发人员！';
   exit;
}

echo '<script>

$.post("../send.php", { sendvalue: sendvalue,username: username,password: password,user_vip: user_vip,cion: cion,type: 1},
   function(data){
	//返回值
   layer.msg(data);
   });
</script>';

echo '发送红包成功';

}
?>
